<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<title>信息来源</title>
$!{include("import_js_css.html")}
</head>
<body>
	$!{include("header.html")}
	<div class="container" style="width: 1200px;">
		<div class="panel panel-info">
			<!--#var(Member member)-->
			$!{include("memberHeader.html")}
			<div id="div_result_member" style="padding: 15px;">
				<div class="panel">
					$!{include("member_info_tab.html")}
					<div id="div_result_member" class="panel-hxcd-info">
						<form class="form-horizontal" action="yueyogaAdmin/editMarketingSource.jhtml" method="post" >
							<input type="hidden" name="id" id="id" value="${member.memberid}">
							<label for="inputMarketingSource" class="col-sm-1 control-label" style="width:100px;">信息来源</label>
							<div class="col-sm-3">
								<select id="memberStatus"
									class="selectpicker show-tick" data-width="100%" name="marketingSource">
									<option value=""> </option>
									<!-- #if(member.marketingsource=='81') -->
									<option value="81" selected="selected">电话打入</option>
									<!-- #else -->
									<option value="81">电话打入</option>
									<!-- #end -->
									<!-- #if(member.marketingsource=='82') -->
									<option value="82" selected="selected">主动拜访</option>
									<!-- #else -->
									<option value="82">主动拜访</option>
									<!-- #end -->
									<!-- #if(member.marketingsource=='83') -->
									<option value="83" selected="selected">数据库</option>
									<!-- #else -->
									<option value="83">数据库</option>
									<!-- #end -->
									<!-- #if(member.marketingsource=='84') -->
									<option value="84" selected="selected">线上活动</option>
									<!-- #else -->
									<option value="84">线上活动</option>
									<!-- #end -->
									<!-- #if(member.marketingsource=='85') -->
									<option value="85" selected="selected">线下活动</option>
									<!-- #else -->
									<option value="85">线下活动</option>
									<!-- #end -->
									<!-- #if(member.marketingsource=='86') -->
									<option value="86" selected="selected">其他</option>
									<!-- #else -->
									<option value="86">其他</option>
									<!-- #end -->
								</select>
							</div>
							<br /><br />
							<label for="inputMarketingChannel" class="col-sm-1 control-label" style="width:100px;">市场渠道</label>
							<div class="col-sm-3">
								<!--#var(Status status,Status status2,Status parentStatu,List<Status> submarketingchannels2)-->
								<select id="inputMarketingChannel"
									class="selectpicker show-tick" data-width="100%" name="inputMarketingChannel">
									<option value=""> </option>
									<!--#foreach(status in marketingChannels)-->
										<!-- #if(status.code==parentCode) -->
											<option value="${status.code}" selected="selected">${status.name}</option>
										<!-- #else -->
											<option value="${status.code}">${status.name}</option>
										<!-- #end -->
									<!-- #end -->
								</select>
							</div>
							<br /><br />
							<label for="inputSubMarketingChannel" class="col-sm-1 control-label" style="width:100px;">子渠道</label>
							<div class="col-sm-3">
								<select id="inputSubMarketingChannel" 
									class="selectpicker show-tick" data-width="100%" name="subMarketingChannel">
									<option value=""> </option>
									<!--#foreach(status2 in submarketingchannels)-->
										
										<!-- #if(status2.code==code) -->
											<option value="${status2.code}" selected="selected">${status2.name}</option>
										<!-- #else -->
											<option value="${status2.code}">${status2.name}</option>
										<!-- #end -->
									<!-- #end -->
								</select>
							</div>
							<br /><br />
							<label for="keepers" class="col-sm-1 control-label">会籍顾问</label>
							<div class="col-sm-3">
								<select id="keepers" 
									class="selectpicker show-tick" data-width="100%" name="keeperId">
									<option value=""> </option>
									<!--#for(GroupUserModel keeper:keepers)-->
										<!-- #if(keeper.id==member.keeperId) -->
											<option value="${keeper.id}" selected="selected">${keeper.name}</option>
										<!-- #else -->
											<option value="${keeper.id}">${keeper.name}</option>
										<!-- #end -->
									<!-- #end -->
								</select>
							</div>
							<br /><br />
							<div class="col-sm-3">
							</div>
							<div class="panel-btn-add" style="float:left;margin-left:130px;">
											<button type="submit" class="btn btn-default btn-ade-default">保存</button>
									</div>
							<br />
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>

<script type="text/javascript">
	$(function(){
		var msg = "${msg1}";
		if(msg!=null&&msg!=""){
			alert(msg);
		}
		
		//去掉下拉输入框
		$("#memberStatus").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#inputMarketingChannel").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
	
		$("#inputSubMarketingChannel").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#keepers").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		//市场渠道
		$("#inputMarketingChannel").change(function() {
			var val =$("#inputMarketingChannel").val();
			console.log(val);
			var sub = document.getElementById("inputSubMarketingChannel");
			if(val == "" ||val == null){
				$("#inputSubMarketingChannel").empty();
				sub.options.length=0;
				option = new Option(" ", "");
				sub.options.add(option);
				return;
			}
			if(!val){
				option = new Option(" ", "");
				sub.options.length=0;
				sub.options.add(option);
			}
			$.post(
				"yueyogaAdmin/substatus.jhtml",
				{"code": val},
				function(response) {
					var res = eval("(" + response + ")");
					if (res.success) {
						var option = null;
						var code = null;
						var name = null;
						sub.options.length=0;
						option = new Option(" ", "");
						sub.options.add(option);
						for(var i=0;i<res.items.length;i++) {
							code = res.items[i].code;
							name = res.items[i].name;
							option = new Option(name, code);
							sub.options.add(option);
						}
					} else {
						alert(res.msg);
					}
				}
			);
		});
	});
</script>
</body>
</html>